$(document).ready(function(){
	$('#userPwdForm').validation();
	$('#cancel').click(function(){
		BootstrapDialog.closeAll();
	})
	
	$('#save').on('click',resetPwd);
});

//重置密码操作
function resetPwd(){
	if(!$("#userPwdForm").validationForm()){
		return;
	}
	
	if($("#newPasswd").val() != $("#confirmNewPasswd").val()){
		customAlertDialog("新密码和确认密码不一致，请重新填写", '错误提示', null, null);
		return;
	}
	
	$.getApiClient('/user/resetPwd').post('#userPwdForm').done(function(data){
		if(data.code == "0"){
			BootstrapDialog.closeAll();
			customTimeOutDialog('信息提示','密码重置成功',null,2000);
		}
	});
}